/**
 * 
 */
package callCenter;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;

import operator.Operator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Nugumanova V.
 *
 */
public class CallCenter {
	private static final Logger LOGGER = LoggerFactory.getLogger(CallCenter.class);
	
	private static CallCenter instance = new CallCenter();
	private BlockingQueue<Operator> operatorQueue = new LinkedBlockingDeque <Operator>();
	
	private CallCenter (){
		for (int i=1; i<=3; i++){
			operatorQueue.add(new Operator(i));			
		}
		LOGGER.info("CallCenter is ready");
	}
	
	public static synchronized CallCenter getInstance(){
		if (instance == null){
			instance = new CallCenter();
		}
		return instance; 
	}

	public BlockingQueue<Operator> getOperatorQueue() {
		return operatorQueue;
	}

	
	@Override
	public String toString() {
		StringBuilder s = new StringBuilder();
		for ( Operator operator: operatorQueue){
			s.append(operator.toString()).append("  ");
		}
		return s.toString();
	}
	

}
